package m.store.model;

import m.base.model.UserInfo;
import m.common.model.*;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name="ts_goods_record_notice",description="商品记录通知")
public class GoodsRecordNotice extends Model implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.eq("repository.store.oid",storeOid))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }

    @LinkTableMeta(name="repository_oid",table= RepositoryInfo.class,description="仓库")
    private RepositoryInfo repository;
    @LinkTableMeta(name="notice_user_oid",table= UserInfo.class,description="通知用户")
    private UserInfo noticeUser;
    @FieldMeta(name="notice_date",type= FieldType.DATE,description="通知时间")
    private Date noticeDate;
    @FieldMeta(name="record_oid",type= FieldType.STRING,length = 50,description="记录主键")
    private String recordOid;
    @LinkTableMeta(name="goods_oid",table= StoreGoods.class,description="商品")
    private StoreGoods goods;
    @FieldMeta(name="price",type= FieldType.DOUBLE,description="单价")
    private Double price;
    @FieldMeta(name="num",type= FieldType.INT,description="数量")
    private Integer num;
    @FieldMeta(name="preferential",type= FieldType.DOUBLE,description="总优惠")
    private Double preferential;
    @FieldMeta(name="amount",type= FieldType.DOUBLE,description="金额")
    private Double amount;
    @FieldMeta(name="preferential_price",type= FieldType.DOUBLE,description="优惠后单价")
    private Double preferentialPrice;
    @FieldMeta(name = "remark",type = FieldType.STRING,length = 1000,description = "备注")
    private String remark;
    @FieldMeta(name="type",type= FieldType.STRING,length = 20,description="类型",dictOption = "RA:出库退货,RB:入库退货")
    private String type;
    public final static String Type_Refund_Sale="RA";
    public final static String Type_Refund_Stock="RB";
    @FieldMeta(name="order_no",type= FieldType.STRING,length = 20,description="订单单号")
    private String orderNo;
    @FieldMeta(name="order_oid",type= FieldType.STRING,length = 50,description="订单主键")
    private String orderOid;
    @FieldMeta(name="order_date",type= FieldType.DATE,description="订单账期")
    private Date orderDate;
    @LinkTableMeta(name="input_user_oid",table= UserInfo.class,description="录入用户")
    private UserInfo inputUser;
    @LinkTableMeta(name="guest_oid",table= GuestInfo.class,description="客户")
    private GuestInfo guest;
    @FieldMeta(name="status",type= FieldType.STRING,description="状态",dictOption = "A:已删除,Y:已阅,N:待阅")
    private String status;
    public final static String Status_Delete="A";
    public final static String Status_Read="Y";
    public final static String Status_Notice="N";
    @FieldMeta(name="oper_date",type= FieldType.DATE,description="操作时间")
    private Date operDate;

    public GuestInfo getGuest() {
        return guest;
    }

    public void setGuest(GuestInfo guest) {
        this.guest = guest;
    }

    public UserInfo getInputUser() {
        return inputUser;
    }

    public void setInputUser(UserInfo inputUser) {
        this.inputUser = inputUser;
    }

    public Date getNoticeDate() {
        return noticeDate;
    }

    public void setNoticeDate(Date noticeDate) {
        this.noticeDate = noticeDate;
    }

    public Date getOperDate() {
        return operDate;
    }

    public void setOperDate(Date operDate) {
        this.operDate = operDate;
    }

    public RepositoryInfo getRepository() {
        return repository;
    }

    public void setRepository(RepositoryInfo repository) {
        this.repository = repository;
    }

    public String getRecordOid() {
        return recordOid;
    }

    public void setRecordOid(String recordOid) {
        this.recordOid = recordOid;
    }

    public UserInfo getNoticeUser() {
        return noticeUser;
    }

    public void setNoticeUser(UserInfo noticeUser) {
        this.noticeUser = noticeUser;
    }

    public StoreGoods getGoods() {
        return goods;
    }

    public void setGoods(StoreGoods goods) {
        this.goods = goods;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Double getPreferential() {
        return preferential;
    }

    public void setPreferential(Double preferential) {
        this.preferential = preferential;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Double getPreferentialPrice() {
        return preferentialPrice;
    }

    public void setPreferentialPrice(Double preferentialPrice) {
        this.preferentialPrice = preferentialPrice;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOrderOid() {
        return orderOid;
    }

    public void setOrderOid(String orderOid) {
        this.orderOid = orderOid;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
